/*
 * External interface for interacting with memory.
 */

package cz.cuni.amis.pogamut.episodic.memory;

import cz.cuni.amis.pogamut.episodic.decisions.Intention;
import cz.cuni.amis.pogamut.episodic.episodes.ObjectNode;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;

/**
 * @author Zdenek Behan
 *
 * Based on the original code by Michal Cermak
 */
public interface IAgentMemory {
    /*
     * Initialize memory at given epoch timestamp, with default node saliency.
     */
    public void initialize(long epoch, int defaultSaliency);
    /*
     * Describes goal and its metadata.
     */
    public void addGoal(String name, int saliency);
    /*
     * Finalizes the initialization, following series of addGoal.
     */
    public void finalizeInit();
    /*
     * Reports a new node into the current events.
     *
     * @param node Name of the Node that was executed.
     * @param trace the full node trace so far for verification purposes.
     * @param affordances Affordances attached to this particular node.
     */
    public boolean openNode(String node, ArrayList<String> trace, ArrayList<Affordance> affordances);

    /*
     * Reports that a given node was closed, ie. the goal has been achieved.
     *
     * @param node Name of the node that was closed.
     * @param trace see above
     * @param success Boolean indicated whether the goal succeeded or failed.
     */
    public boolean closeNode(String node, ArrayList<String> trace, boolean success);

    /*
     * Reports that an atomic action has been executed.
     *
     * @param atomicAction name of the action executed.
     * @param trace see above.
     * @param affordances affordances attached to this atomic action.
     */
    public boolean executeAction(String atomicAction, ArrayList<String> trace, ArrayList<Affordance> affordances);

    /*
     * Advance time by the given number of seconds, vaguely resemling the unix
     * epoch. Epoch starts with creation of the memory.
     *
     * @param epoch Seconds to add.
     */
    public void advanceTime(long epoch);

    /*
     * Shorthand functions.
     */
    public void advanceDay(long days);
    public void advanceHour(long hours);
    public void advanceMinute(long minutes);

    /*
     * A function to indicate that the agent should sleep at this point.
     */
    public void performSleep();

    /*
     * Alternately, if the caller prefers to keep track of them time itself,
     * it can just update the time to the given value.
     *
     * @param epoch Seconds since the start of epoch.
     */
    public void updateTime(long epoch);
}
